<?php
    if(kiemtra_dulieurong()==true)
        return;
    
    if(isset($_POST['MaNguoiDung']))
        $id = $_POST['MaNguoiDung'];
    else $id = -1;
    
    $HoTen = $_POST['HoTen'];
    $NgaySinh = $_POST['NgaySinh'];
    $ThangSinh = $_POST['ThangSinh'];
    $NamSinh = $_POST['NamSinh'];
    $NgayThangNamSinh = chuyendoi_nam_thang_ngay($NgaySinh."/".$ThangSinh."/".$NamSinh,"/","-");;
    $DiaChi = $_POST['DiaChi'];
    $Email = $_POST['Email'];
    $SoDienThoai = $_POST['SoDienThoai'];
    $TenDangNhap = $_POST['TenDangNhap'];
    $MatKhau = $_POST['MatKhau'];
    $XacNhanMatKhau = $_POST['XacNhanMatKhau'];
    $QuyenHan = $_POST['QuyenHan'];
    
    $nguoidung = new nguoidungbs();
    $nguoidung->MaNguoiDung = $id;
    $ret_nguoidung = $nguoidung->GetListUser();
    
    $nguoidung->HoTen = $HoTen;
    $nguoidung->NgaySinh = $NgayThangNamSinh;
    $nguoidung->DiaChi = $DiaChi;
    $nguoidung->Email = $Email;
    $nguoidung->SoDienThoai = $SoDienThoai;
    $nguoidung->TenDangNhap = $TenDangNhap;
    $nguoidung->MatKhau = md5($MatKhau);
    $nguoidung->QuyenHan = $QuyenHan;
    
    if($nguoidung->Update())
        echo "Thành công!";
    else
        echo "Thất bại";
?>